package com.cssy.xxkj.basic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.basic.dao.BasicCompanyTestDAO;
import com.cssy.xxkj.basic.entity.BasicCompanyTestDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-09-02
 */
public class BasicCompanyTestDAOImpl extends SqlMapClientDaoSupport implements BasicCompanyTestDAO {

    /**
     * 插入数据
     * @param basicCompanyTestDO
     * @return 插入数据的主键
     */
    public String insertBasicCompanyTestDO(BasicCompanyTestDO basicCompanyTestDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("BasicCompanyTest.insert", basicCompanyTestDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param basicCompanyTestDO
     * @return 查出的记录数
     */
    public Integer countBasicCompanyTestDOByExample(BasicCompanyTestDO basicCompanyTestDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("BasicCompanyTest.countByDOExample", basicCompanyTestDO);
        return count;
    }

    /**
     * 更新记录
     * @param basicCompanyTestDO
     * @return 受影响的行数
     */
    public Integer updateBasicCompanyTestDO(BasicCompanyTestDO basicCompanyTestDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("BasicCompanyTest.update", basicCompanyTestDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param basicCompanyTestDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<BasicCompanyTestDO> findListByExample(BasicCompanyTestDO basicCompanyTestDO) throws DataAccessException {
        List<BasicCompanyTestDO> list = getSqlMapClientTemplate().queryForList("BasicCompanyTest.findListByDO", basicCompanyTestDO);
        return list;
    }

    /**
     * 根据主键获取basicCompanyTestDO
     * @param id
     * @return basicCompanyTestDO
     */
    public BasicCompanyTestDO findBasicCompanyTestDOByPrimaryKey(String id) throws DataAccessException {
        BasicCompanyTestDO basicCompanyTestDO = (BasicCompanyTestDO) getSqlMapClientTemplate().queryForObject("BasicCompanyTest.findByPrimaryKey", id);
        return basicCompanyTestDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteBasicCompanyTestDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("BasicCompanyTest.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<BasicCompanyTestDO> find(SearchConditions scs)
			throws DataAccessException {
		List<BasicCompanyTestDO> list = getSqlMapClientTemplate().queryForList("BasicCompanyTest_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("BasicCompanyTest_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		int result = (Integer)getSqlMapClientTemplate().queryForObject("BasicCompanyTest_ex.deleteBizRemoved", id);
        return result;
	}

}